CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(cl_compiler)

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -ldl")

SET(CMAKE_SOURCE_DIR .)
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)

AUX_SOURCE_DIRECTORY(. DIR_SRCS)
ADD_SUBDIRECTORY(./compiler)
ADD_EXECUTABLE(cl_compiler ${DIR_SRCS})

OPTION(BUILD_SHARED_LIBS "Set to OFF to build static libraries" ON)

Find_Package(LLVM REQUIRED)
Find_Package(Clang REQUIRED)
Find_Package(Threads)

TARGET_LINK_LIBRARIES(cl_compiler COMPILER)

INCLUDE_DIRECTORIES (.
                    ${LLVM_INCLUDE_DIR}
                    ${CLANG_INCLUDE_DIRS}
                    )

TARGET_LINK_LIBRARIES(cl_compiler
		    ${CLANG_LIBS}
		    ${LLVM_LIBS_CORE}
			${CMAKE_THREAD_LIBS_INIT}
		    )
